<!-- /* Description for file.
 * 资源预订 -修改
 * @copyright     Copyright 2008-2010, PHInfo Services Inc. (http://www.phinfoservices.com)
 * @package       ues
 * @subpackage    ues/app/views/resourcebooks
 * @since         ues
 * @version       V0.0.1
 * @modifiedby    张海杰2011年0625
 * @lastmodified  张海杰2011年0625
 */
 -->
<?php
echo $html->css ( 'tab' );
echo $html->css ( 'jquery-validate/css/screen' );
?>

<script type="text/javascript">
//添加验证
$(document).ready(function() {
	$.validator.setDefaults({       
		 submitHandler: function(form) {    
		  form.submit();
  
		}     
	});   
			
	$("#ResourcebookEditForm").validate({
		rules: {
		"data[Resourcebook][title]"  :{
			required: true,alowsome:true,stringMinLength:1,stringMaxLength:50
			},//主题
			"data[Resourcebook][useage]"  :{
				required: false,stringMinLength:0,stringMaxLength:255
				}
		},
		messages:{maxitem:{required: "请输入"}},
		focusInvalid:false,
		onkeyup:false,
		errorPlacement:function(error, element){error.appendTo(element.parent());}
	});
});
//验证结束
</script>
<script type="text/javascript">
//级联菜单 //
$(function() {
	$("#ResourcebookOrganId").change(function(){
		var list = $(this).val();
		if(list!="")
		{
			$.post("<?php echo ROOT_WEB_PATH; ?>/resourcebooks/getResource/",{
				Resource : $(this).val()
				},function(data,textStatus){
					 $("#ResourcebookResourceId:eq(0)>option").remove();
					 $(data).find("aaa").each(function(){
					//	 alert($(this).attr("name"));
					 $("#ResourcebookResourceId:eq(0)").append("<option></option>");
					 $("#ResourcebookResourceId:eq(0)>option:last").val($(this).attr("name")).html($(this).text());				 
				  });

				});
		}

	});
});
</script>
<!-- 当前位置-->
<div id="tabmenubar">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td class="tabmenubartitle1"><?php echo  __('YourPosition');//您现在的位置：?></td>
		<td class="tabmenubartitle2"><?php echo __('Resourcebooksmanage');//一级目录
										   echo '>';echo __('Resourcebooksmanage');//二级目录
										   echo '>';?>
									<?php echo $html->tag('span', __('Edit Resourcebooks',true));//当前操作地用span加粗?> 						  
		</td>
	</tr>
</table>
</div>
<!-- 当前位置-->
 <?php echo $form->create('Resourcebook',array('action'=>'edit','type'=>'post'));?>
<div class="tabflex">
<fieldset>
 	<legend><?php __('Edit Resourcebooks');?></legend>
	<table width="100%" cellspacing="0" cellpadding="0" border="0" style="text-align: left">

	<tr>
		<td width="50"><!-- 6个td -->
		<?php
					echo $form->hidden('id',array('default'=>$resourcebook['Resourcebook']['id']));
					echo $form->hidden('creater',array('default'=>$resourcebook['Resourcebook']['creater']));
					echo $form->hidden('updater',array('default'=>$resourcebook['Resourcebook']['updater']));	?></td>
		<td width="100"><?php __('subject');?>:<font color="red">*</font></td>
		<td ><?php echo $form->input('title',array('class' => 'TextBoxE1','label'=>false,'default'=>$resourcebook['Resourcebook']['title']));?></td>
		<td width="50"></td>
		<td width="100"><?php __('ResourceSelect');?>:</td>
		<td width="40%"> 
					<?php $options = array();
								foreach($organs as $eachrecord)
								{					
									$options[$eachrecord['Organ']['id']] = $eachrecord['Organ']['name'];
								}
								if($resourcebook['Resourcebook']['organ_id']== NULL){
									echo $form->input('organ_id',array('options'=>$options,'label'=>false,'div'=>false,'class'=>'TextBoxE1','empty' =>"不限"));
								}
								else{
									echo $form->input('organ_id',array('options'=>$options,'label'=>false,'div'=>false,'class'=>'TextBoxE1','empty' =>'不限','default' =>$resourcebook['Resourcebook']['organ_id']));	
									
								}
								//echo  $resourcebook['Resourcebook']['organ_id'];					
					//机构下拉菜单?>
					<?php $options1 = array();
								foreach($resource as $eachrecord)
								{					
									$options1[$eachrecord['Resource']['id']] = $eachrecord['Resource']['resourceName'];
								}
								echo $form->input('resource_id',array('options'=>$options1,'label'=>false,'div'=>false,'class'=>'TextBoxE1','default' =>$resourcebook['Resourcebook']['resource_id']));
					//机构下资源（设施）下拉菜单?>
		</td>

	</tr>
	<tr>
		<td width="50"></td>
		<td width="100"><?php __('Creator');//创建人?>:</td>
		<td ><?php echo $form->input('founder',array('class' => 'TextBoxL txtOut','label'=>false,'default'=>$resourcebook['Resourcebook']['creater'],'disabled'=>'disabled',));?></td>
		<td width="50"></td>
		<td width="100"><?php __('Create_Time');//创建时间?>:</td>
		<td><?php echo $form->input('creationTime',array('label'=>false,'disabled'=>'disabled','dateFormat'=>'YMD','monthNames' => false, 'timeFormat'=> '24','selected' => $resourcebook['Resourcebook']['created']));?></td>
	</tr>
	<tr>
		<td width="50"></td>
		<td width="100"><?php __('StartUseTime');//开始时间?>:</td>
		<td ><?php 
			echo $form->input('startTime',array('label'=>false,'dateFormat'=>'YMD', 'monthNames' => false,'timeFormat'=> '24','selected' => $resourcebook['Resourcebook']['startTime']));
		
		?></td>
		<td width="50"></td>
		<td width="100"><?php __('EndUseTime');//结束时间?>:</td>
		<td><?php echo $form->input('endTime',array('label'=>false,'dateFormat'=>'YMD','monthNames' => false, 'timeFormat'=> '24','selected' => $resourcebook['Resourcebook']['endTime']));?></td>
	</tr>
	<tr>
		<td width="50"></td>
		<td width="100"><?php __('ResourcebooksUser');//使用人?>:</td>
		<td colspan="4">
			<?php $options2 = array();
								foreach($users as $eachrecord)
								{					
									$options2[$eachrecord['User']['id']] = $eachrecord['User']['username'];
								}
								echo $form->input('user',array('options'=>$options2,'label'=>false,'div'=>false,'class'=>'TextBoxE1','default' => $resourcebook['Resourcebook']['user']));					
					//使用者选择下拉菜单?>
		</td>
	</tr>
	<tr>
		<td width="50"></td>
		<td width="100"><?php __('ResourcebooksUseage');?>:</td>
		<td colspan="4">
		<?php echo $form->textarea('useage',array('class' => 'areaStyle','label'=>false,'default'=>$resourcebook['Resourcebook']['useage']));?>
		</td>
	</tr>
	</table>
	</fieldset>
</div>

<table width="100%" cellspacing="0" cellpadding="0" border="0" style="text-align: left">
	<tr>
		<td width="50"></td>
		<td width="100"><?php echo $form->button('确定',array('type'=>'submit','class'=>'oksubmit'));?> <!-- __('Add', true)增加-->
		</td>
		<td width="100"><?php echo $form->button('重置',array('type'=>'reset','class'=>'resetsubmit'));?>  <!-- __('reset', true)取消-->
		</td>
	</tr>
</table>
<?php echo $form->end();?>